@echo off

SET MGOS_TESTBUILD=1

REM --------------------------------------------------------------------------
SET MGOS_KERNEL_DIR=%CD%\KERNEL
SET MGOS_LIB_DIR=%CD%\LIB
REM --------------------------------------------------------------------------

@echo.
@echo Building MeganetOS (Test Build)
@echo.

set BUILDDIR=%CD%

cd Z_INT
copy *.* ..\ > NUL
cd ..

copy buildmod.bat+asmbuild.txt+objcheck.bat buildasm.bat > NUL
copy buildmod.bat+cbuild.txt+objcheck.bat buildc.bat > NUL
copy buildmod.bat+cppbuild.txt+objcheck.bat buildcpp.bat > NUL

@echo. :end_build >> buildasm.bat
@echo. :end_build >> buildc.bat
@echo. :end_build >> buildcpp.bat

IF EXIST dirlist.txt DEL dirlist.txt

DIR /AD /S /B >> dirlist.tmp
DIRLIST.exe

FOR /F %%i in (dirlist.txt ) DO call buildfiles.bat %%i

IF EXIST dirlist.txt DEL dirlist.txt
IF EXIST buildasm.bat DEL buildasm.bat
IF EXIST buildc.bat DEL buildc.bat
IF EXIST buildcpp.bat DEL buildcpp.bat

cd %BUILDDIR%

DIR /B /A-D >> filelist.txt
for /f %%a IN (filelist.txt ) do call clean.bat %%a
IF EXIST clean.bat DEL clean.bat > NUL
IF EXIST filelist.txt DEL filelist.txt > NUL

pause
